<form action="" method="get" name="change_form" style="font-size:16px; padding:4px; border-bottom:1px solid black;">
<div style="font-size:15px;padding:8px;font-weight:bold;">Current Property: <select onchange="update_button(this.value)" name="listing_id">
<option value="">--Select Property--</option>
 <?php 
 $query2 = "select p.* from PROPERTIES p inner join Prop_Owner_Con c on p.OID = c.Prop_OID where c.Owner = '".$_SESSION['id']."' ORDER BY sort_order";
 $result2 = mysql_query($query2) or die ("SQL Error".mysql_error());
 if(mysql_num_rows($result2))
 {
 	while($row2=mysql_fetch_assoc($result2))
 	{
			?>
			<option value="<?php echo $row2['OID']?>" <?php if($_REQUEST['listing_id'] == $row2['OID']){?>selected='selected'<?php } ?>><?php echo $row2['STREETNUM']." ".$row2['STREETNAME']." ".$row2['STREETSUFFIX'] ?></option>
			<?
 	}
 }
	?>
	</select>
	 <script language="JavaScript" type="text/javascript">
	 /*var cval = "<?php echo $_GET['listing_id']; ?>";
	 for(i=0;i<document.forms[0].listing_id.options.length;i++)
	 if(document.forms[0].listing_id.options[i].value==cval)
	 document.forms[0].listing_id.options[i].selected=true;*/

	 function update_button(val)
	 {
	 	if(val=='') return false;
	 	document.getElementById('button_change').innerHTML = '<input style="background-color:#2acf04; color:#ffffff;" name="update" type="submit" value="Now Click Here">';
	 }
					</script>
	<span id=button_change><input name="update" type="submit" value="Change Listing"></span>
	<?php if(isset($_REQUEST['listing_id'])) { ?>
<a href="/vt/<?php echo $_REQUEST['listing_id']?>" style="color:#D50000">Virtual Tour Preview</a>
	<?php } ?>
</div>
</form>
